﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="SelectPersonToLogin.aspx.cs" Inherits="WebApplication.Restricted.Modal.SelectPersonToLogin" MasterPageFile="~/MasterPages/Modal.Master" %>

<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>

<%@ Register Assembly="System.Web.Entity, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
    Namespace="System.Web.UI.WebControls" TagPrefix="asp" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="server" >
    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" DefaultLoadingPanelID="RadAjaxLoadingPanel1">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="PersonsGrid">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="PersonsGrid" LoadingPanelID="RadAjaxLoadingPanel1" />
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
    </telerik:RadAjaxManager>
    <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" Skin="Default" />
    <telerik:RadGrid ID="PersonsGrid" runat="server" AllowFilteringByColumn="True"
        AllowPaging="True" AllowSorting="True" GridLines="None" Skin="WebBlue" DataSourceID="PersonsEntityDataSource">
        <MasterTableView AutoGenerateColumns="False" DataKeyNames="Id" ClientDataKeyNames="Id,Name,ProvinceName"
            DataSourceID="PersonsEntityDataSource">
            <RowIndicatorColumn>
                <HeaderStyle Width="20px"></HeaderStyle>
            </RowIndicatorColumn>
            <ExpandCollapseColumn>
                <HeaderStyle Width="20px"></HeaderStyle>
            </ExpandCollapseColumn>
            <Columns>
                <telerik:GridBoundColumn DataField="Id" DataType="System.Int32" HeaderText="Id" SortExpression="Id"
                    UniqueName="Id">
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="Name" HeaderText="Imie" SortExpression="Name"
                    UniqueName="Name">
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="Surname" HeaderText="Nazwisko" SortExpression="Surname"
                    UniqueName="Surname">
                </telerik:GridBoundColumn>
            </Columns>
        </MasterTableView>
        <ClientSettings>
            <Selecting AllowRowSelect="true" />
            <ClientEvents OnRowSelected="RowSelected" />
        </ClientSettings>
    </telerik:RadGrid>
    
    <asp:EntityDataSource ID="PersonsEntityDataSource" runat="server" ConnectionString="name=MerchModelEntities"
        DefaultContainerName="MerchModelEntities" CommandText="select employee.Id as Id, employee.Name as Name, employee.Surname as SurName from MerchModelEntities.Employee as employee"
        Select="it.[Id], it.[Name], it.[Surname]" OrderBy="it.[Id]">
    </asp:EntityDataSource>
    
    <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
        <script type="text/javascript">
            function RowSelected(sender, eventArgs) {
//                var city = new Object();
//                city.Id = eventArgs.getDataKeyValue("Id");
//                city.Name = eventArgs.getDataKeyValue("Name");
//                city.Province = new Object();
//                city.Province.Name = eventArgs.getDataKeyValue("ProvinceName");
//                window.frameElement.radWindow.close(city);
            }
        </script>
    </telerik:RadCodeBlock>
</asp:Content>
